<extend name="Base/common"/>
<block name="Content">
	<div class="am-cf am-padding-top">
        <div class="am-fl am-cf">
            <i class="am-icon-pencil-square-o"></i>
            <strong class="am-text-primary am-text-lg">
               <notempty name="classModel">
                    编辑<else/>新增
                </notempty>服务类型
            </strong>
        </div><hr data-am-widget="divider" class="am-divider am-divider-default" />
    </div>
                <form class="am-form" method="post" action="{:U('saveAction')}">
                    <div class="am-g am-margin-top">
                        <div class="am-u-sm-4 am-u-md-2 am-text-right">
                            排序号
                        </div>
                        <div class="am-u-sm-8 am-u-md-4 am-u-end col-end">
                            <input type="number" class="am-input-sm" min="1" step="1"
                            	name="sort_no" value="{$classModel['sort_no']}">
                        </div>
                        <div class="am-hide-sm-only am-u-md-6">
                            *值越小，显示位置越靠前
                        </div>
                    </div>
                    <div class="am-g am-margin-top">
                        <div class="am-u-sm-4 am-u-md-2 am-text-right">
                            服务类型名称
                        </div>
                        <div class="am-u-sm-8 am-u-md-4">
                            <input type="text" class="am-input-sm" name="class_name" value="{$classModel['class_name']}" required/>
                        </div>
                        <div class="am-hide-sm-only am-u-md-6">
                            *必填，不可重复
                        </div>
                    </div>
                    <div class="am-g am-margin-top">
                        <div class="am-u-sm-4 am-u-md-2 am-text-right">
                            所属上级
                        </div>
                        <div class="am-u-sm-8 am-u-md-4">
                            <select data-am-selected="{btnSize: 'sm', btnStyle: 'secondary',maxHeight: 200}" 
                            	name="parent_id" id="parent_id">
                                <option value="0">无</option>
                                <foreach name="classTree" item="vo">
                                    <option value="{$vo.class_id}">|─({$vo.sort_no})-{$vo.class_name}</option>
                                    <notempty name="vo['_child']">
                                        <foreach name="vo['_child']" item="sub_class">
                                            <option value="{$sub_class.class_id}">|　|─({$sub_class.sort_no})-{$sub_class.class_name}</option>
                                        </foreach>
                                    </notempty>
                                </foreach>
                            </select>
                        </div>
                        <div class="am-hide-sm-only am-u-md-6">
                        </div>
                    </div>
                    <div class="am-g am-margin-top">
                        <div class="am-u-sm-4 am-u-md-2 am-text-right">
                            关联工种
                        </div>
                        <div class="am-u-sm-8 am-u-md-4">
							<select name="skill[]" id="skill[]" multiple
		                    	data-am-selected="{btnSize: 'sm', btnStyle: 'secondary',maxHeight: 200}">
	                            <volist name=":get_dictionary_enum('profession_options')" id="vo">
	  								<option value="{$key}"
	  									<in name="key" value="$classModel['profession']">selected</in>>{$vo.enum_name}</option>
	  							</volist>
	                        </select>
                        </div>
                        <div class="am-hide-sm-only am-u-md-6">
                        </div>
                    </div>
                    
                    <div class="am-g am-margin-top">
                        <div class="am-u-sm-4 am-u-md-2 am-text-right">
                            细项全部为紧急服务
                        </div>
                        <div class="am-u-sm-8 am-u-md-4">
                        	<input type="radio" name="emergency" value="1"/>是<input type="radio" name="emergency" value="2"/>否
                        </div>
                        <div class="am-hide-sm-only am-u-md-6">
                        </div>
                    </div>
                    <div class="am-margin">
                        <button type="submit" class="am-btn am-btn-success am-btn-xs ajax-post" target-form="am-form">
                            提交保存
                        </button>
                        <button type="button" class="am-btn am-btn-secondary am-btn-xs" onclick="javascript:history.back(-1);return false;">
                            返回列表
                        </button>
                        <input type="hidden" name="class_id" value="{$classModel['class_id']}"/>
                    </div>
                </form>
</block>

<block name="script">
<script type="text/javascript">
Think.setValue('parent_id',{$classModel.parent_id|default=0});
Think.setValue('emergency',{$classModel.emergency|default=2});
</script>

</block>